#include"../../client/rpc_client.hpp"
//订阅客户端

void callback(const std::string& key ,const std::string& message)
{
    ILOG("%s 主题收到消息推送: %s " ,key.c_str() ,message.c_str());
}

int main()
{
    //实例化客户端对象
    auto client = std::make_shared<RPC_project::client::SubscribePublishClient>("127.0.0.1" ,7070);

    //创建主题
    bool ret = client->creatTopic("cool");
    if(!ret)
    {
        ELOG("创建主题失败！ ");
    }
    //订阅主题 
    ret = client->subscribeTopic("cool" ,callback);
    //等待 ->退出
    std::this_thread::sleep_for(std::chrono::seconds(10));//休眠十秒
    client->shutdown();
    return 0;
}